﻿/* ===============================================
* 功能描述：LoginViewModel  
* 创 建 人：阿拉丁等等等灯
* 创建日期：2021/4/26 17:03:47
* CLR版本：4.0.30319.42000
* 机器名称：YANXH-PC
* 用户所在域：YANXH-PC
* 注册组织名：
* 命名空间名称：TodoCase
* 当前登录用户名：mryan
* ================================================*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using TodoCase.BaseClass;
using TodoCase.Model;
using TodoCase.Utils;

namespace TodoCase
{
    public class LoginViewModel: MyBindingBase
    {
        public string LoginID
        {
            get { return Properties.Settings.Default.LoginID; }
            set
            {
                Properties.Settings.Default.LoginID = value;
                OnPropertyChanged("LoginID");
            }
        }

        public MyDelegateCommand LoginCommand { get; set; }

        public LoginViewModel()
        {
            LoginCommand = new MyDelegateCommand(LoginCommandExe);
        }


        private void LoginCommandExe(object paramter)
        {
            if (null != paramter && paramter is System.Windows.Controls.PasswordBox pawBox)
            {
                if (string.IsNullOrEmpty(LoginID))
                {
                    MessageBox.Show("账户名");
                    return;
                }
                if (string.IsNullOrEmpty(pawBox.Password))
                {
                    MessageBox.Show("请输入密码");
                    return;
                }

                var sources = DBHelper.SugarClient.Queryable<CaseModel>().ToList();

            }
        }
    }
}
